<template>
  <div>
     <div class="table-body">
      <el-table :data="tableData" border v-loading="isLoading" style="width: 100%">
        <el-table-column prop="cardNumber" label="储值卡卡号"></el-table-column>
        <el-table-column
          prop="isBind"
          label="是否绑定用户"
          :formatter="(row) => { return row.isBind == '1' ? '是' : '否' }"
        ></el-table-column>
        <el-table-column prop="balance" label="余额">
          <template slot-scope="scope">
            ￥
            <span>{{scope.row.balance}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="wechatNick" label="绑定用户微信昵称"></el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination
          background
          @current-change="currentPageChange"
          layout="prev, pager, next"
          :total="total"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "",
  data() {
    return {
      isLoading:false,
      tableData:[],
      total:1,
      param:{
        data:{
          storedCardId:""
        },
       queryRequest: {
          page: 1,
          size: 10
        }
      }
    };
  },
  components: {},
  computed: {},
  beforeMount() {},
  props:["data"],
  mounted() {
    this.param.data.storedCardId =this.data.id;
    this.initData();
  },
  methods: {
    initData(){
      this.$service.getStoredCardById(this.param).then(res => {
        if(res.code =="00000"){
          this.tableData =res.data.rows;
          this.total =res.data.total || 1;
        }
      });
    },
    currentPageChange(e){
      this.param.queryRequest.page =e;
      this.initData();
    }
  },
  watch: {}
};
</script>
<style scoped>
</style>
